{{include file="common@layout/_meta_x-admin" /}}
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <fieldset class="layui-elem-field">
                <legend>配送管理</legend>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form " >
                        <thead>
                        <tr>
                            <th >配送距离</th>
                            <th >配送费</th>
                            <th >操作</th>
                        </tr>
                        </thead>
                        <tbody id="table_tr">
                        {{volist name="list" id="vo" }}
                        <tr data-id="{{$vo.id}}" class="row">
                            <td><input type="text" data-field="distance" value="{{$vo.distance}}"  required="" lay-verify="number" maxlength="10"  autocomplete="off" class="layui-input"></td>
                            <td><input type="text" data-field="price" value="{{$vo.price}}"  required="" lay-verify="number" maxlength="10"  autocomplete="off" class="layui-input"></td>
                            <td>{{:widget('common/Button/delete',['del',['id' => $vo['id']],$permissionStringArray])}}</td>
                        </tr>
                        {{/volist}}
                        </tbody>
                        <tr><td colspan="3"><button class="layui-btn layui-btn-xs"><i class="layui-icon"></i>添加规则</button></td></tr>
                    </table>
                </div>
            </fieldset>
        </form>
    </div>
</div>
</body>
<script>
    $(function () {
        $(".layui-btn").click(function () {
            $.ajax({
                url:"store.view.store_cash.add",type:"post",dataType:"json",
            })
        })
        $(".row input").change(function () {
            var _this = $(this);
            var id=_this.parent().parent().data('id');
            $.ajax({
                type:"post",dataType:"json",
                data:{id:id,field:_this.data('field'),value:_this.val()},
                success:function () {
                    layer.msg('修改成功');
                }
            })
        })
    })
</script>